package com.joyintech.controller;


import com.joyintech.util.JacksonUtil;
import com.joyintech.util.ResponseData;
import com.joyintech.util.ZhfxCode;
import com.joyintech.vo.Person;
import lombok.extern.log4j.Log4j2;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 客户基本信息表 前端控制器
 * </p>
 *
 * @author shenshengfa
 * @since 2024-09-23
 */
@Log4j2
@RestController
@RequestMapping("/demo")
public class DemoController {

    /**
     * 分页查询客户信息列表
     */
    @PostMapping("/test")
    public ResponseData test(@RequestBody Person entity) {
        log.info("--分页查询产品列表--entity {}", JacksonUtil.toJSONString(entity));

        try {
            ResponseData responseData = new ResponseData(ZhfxCode.ZHFX_000000);

            responseData.setData(entity);
            return responseData;
        } catch (Exception e) {
            log.error(e);
            return new ResponseData(ZhfxCode.ZHFX_000099, e.getMessage());
        }
    }

    @PostMapping(value ="/test" , consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseData userRegiseter(@RequestBody  TestPageVo vo) {
        log.info("test -> {}", vo);
        ResponseData responseData = new ResponseData(ZhfxCode.ZHFX_000000);
        return responseData;
    }

}
